<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="<%=basePath %>leyuiyc/css/font.css">
        <link rel="stylesheet" href="<%=basePath %>leyuiyc/css/xadmin.css">
        <script src="<%=basePath %>leyuiyc/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="<%=basePath %>leyuiyc/js/xadmin.js"></script>
		<style>
		    /* body{overflow-y: scroll;} */ /* 禁止刷新后出现横向滚动条 */
		    /* .layui-table-body .layui-table,.layui-table-header .layui-table{width: 110%;}
			.layui-table-body.layui-table-main .layui-table-cell,.layui-table-header .layui-table-cell{white-space: pre-wrap;word-wrap: break-word; word-break: break-all; height: auto;} */
		</style>
        <script src="<%=basePath %>leyuiyc/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="<%=basePath %>leyuiyc/js/xadmin.js"></script>
		
    </head>
    
    <body>
        
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form layui-col-space5">
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="userId" placeholder="请输入用户id" autocomplete="off" class="layui-input"></div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="userName" placeholder="请输入用户名" autocomplete="off" class="layui-input"></div>
                                <div class="layui-input-inline layui-show-xs-block" >
                                    <select name="orderState">
                                        <option value="">订单状态</option>
                                        <option value="10">待确认</option>
                                        <option value="20">已确认</option>
                                        <option value="30">已配货</option>
                                        <option value="40">已发货</option>
                                        <option value="50">已收款</option>
                                        <option value="0">已取消</option>
                                        <option value="60">已退货</option></select>
                                </div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="userCardNumber" placeholder="会员卡号" autocomplete="off" class="layui-input"></div>
                                 <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="receiverPhone" placeholder="收货人电话" autocomplete="off" class="layui-input"></div>
                                <div class="layui-inline layui-show-xs-block">
                                    <input class="layui-input"  autocomplete="off" placeholder="下单日期" name="start" placeholder="yyyy-MM-dd HH:mm:ss" id="start">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
                                    <input class="layui-input"  autocomplete="off" placeholder="截止日期" name="end" placeholder="yyyy-MM-dd HH:mm:ss" id="end">
                                </div>
                                <div class="layui-inline layui-show-xs-block">
				  					<input class="layui-input" id="condition" type="hidden" name="condition" value="40"/>
				  				</div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="orderSn" placeholder="订单号" autocomplete="off" class="layui-input"></div>
                                <div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
                                </div>
                            </form>
                        </div>
                        <div class="layui-card-body ">
                            <table class="layui-table layui-form" id="test" lay-filter="test">
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    
    
    <script>
			layui.use(['table','form','jquery','laydate'], function(){
			  var table = layui.table,
			  laydate = layui.laydate,
			  form = layui.form ;
			  //执行一个laydate实例
		        laydate.render({
		          elem: '#start' //指定元素
		          ,type: 'datetime'
		        });
		
		        //执行一个laydate实例
		        laydate.render({
		          elem: '#end' //指定元素
		          ,type: 'datetime'
		        });
			  table.render({
			    elem: '#test'
			    ,url:'<%=basePath %>DDGL060/list.do?orderState=40'
			    ,width: 'auto'
			    ,height: 700
			    ,method: 'post'
			    ,toolbar: true
			    ,title: '订单信息表'
			    ,totalRow: true
			    ,page: true
			    ,cols: [[
			    	{field:'',type:'numbers',width:50,title: '序号', sort: true, fixed: 'left'}
			      ,{field:'orderSn', width:130, title: '订单编号'}
			      ,{field:'userName', width:110, title: '会员名称'}
			      ,{field:'goodsName', width:110, title: '商品名称'}
			      ,{field:'goodsNum', width:110, title: '商品数量'}
			      ,{field:'specifications', width: 130, title: '商品规格'}
			      ,{field:'goodsType', width:130, title: '商品属性',templet:'#goods_Type'}
			      ,{field:'userCardNumber', width:110, title: '会员卡号'}
			      ,{field:'receiverPhone', width:110, title: '会员电话'}
			      ,{field:'orderAmount', width:110, title: '订单金额（￥）'}
			      ,{field:'orderState', width:110, title: '订单状态' ,templet:'#state'}
			      ,{field:'receiptMethod', width:110, title: '收货方式'}
			      ,{field:'receiverAddress', width:110, title: '收货地址'}
			      ,{field:'addTime', width:110, title: '订单生成时间'}
			      ,{field:'orderId', width: 120, title: '订单id'}
			      ,{field:'', width:130, title: '操作', fixed: 'right',toolbar:'#operation'}
			    ]]
			    ,even:true
			    ,skin: 'row' //表格风格
                ,limits:[10,20,30,40,50]
			    ,limit: 20 //每页默认显示的数量
			  });
			  //数据筛选
		        form.on('submit(search)',function(data){
		            //执行重载
		            table.reload('test', {
		                where:data.field,
		                	page : {
								curr : 1 //从第一开始查看
						}
		            });
		            return false;
		        });
    		table.on('tool(test)', function(obj) {
    			var data = obj.data;
    			if (obj.event === 'confirm') {
    			$.ajax({
    						url : "selectOrder.do?orderSn=" + data.orderSn,
    						method : "post",
    						dataType : "json",
    						success : function(data) {
    						console.log(data.data);
    						var rName = data.data[0].receiverName;
    						var rPhone = data.data[0].receiverPhone;
    								layer.open({
							        type: 1
							        ,title: false //不显示标题栏
							        ,closeBtn: false
							        ,area: '300px;'
							        ,shade: 0.8
							        ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
							        ,btn: ['确定收货', '取消']
							        ,btnAlign: 'c'
							        ,moveType: 1 //拖拽模式，0或者1
							        ,content: '<div style="padding: 50px; line-height: 22px; background-color: #393D49; color: #fff; font-weight: 300;">收货人名称：'+rName+'<br><br>收货人电话：'+rPhone+'<br><br>请准保用户已经付过钱了哦 ^_^</div>'
							        ,success: function(layero){
							          var btn = layero.find('.layui-layer-btn');
							          btn.find('.layui-layer-btn0').attr({
							            href: 'http://www.layui.com/'
							            ,target: '_blank'
							          });
							        }
							      });
    						}
    					})
    			}
    		});
    	});
			
	</script>
	<script type="text/html" id="goods_Type">
		<%--商品属性（0:正品;1:打折;2:体验;3:积分兑换;4:用来打包;5:打包品7:可兑换打包品)--%>
		{{#  if(d.goodsType == "0") {  }}
		<font color="#00ff00">正品</font>
		{{#  } else if(d.goodsType == "1") {  }}
		<font color="#ff0000">打折品</font>
		{{#  } else if(d.goodsType == "2") {  }}
		<font color="#ff0000">体验品</font>
		{{#  } else if(d.goodsType == "3") {  }}
		<font color="#ff0000">积分兑换品</font>
		{{#  } else if(d.goodsType == "4") {  }}
		<font color="#ff0000">用来打包品</font>
		{{#  } else if(d.goodsType == "5") {  }}
		<font color="#ff0000">打包品</font>
		{{#  } else if(d.goodsType == "7") {  }}
		<font color="#ff0000">可兑换打包品</font>
		{{#  }  }}

	</script>
	<script type="text/html" id="state">	
	   {{#  if(d.orderState == "0") {  }}
			<font color="#00ff00">已取消</font>
		{{#  } else if(d.orderState == "10") {  }}
			<font color="#ff0000">待确认</font>
         {{#  } else if(d.orderState == "20") {  }}
			<font color="#ff0000">已确认</font>
		{{#  } else if(d.orderState == "30") {  }}
			<font color="#ff0000">已配货</font>
		{{#  } else if(d.orderState == "40") {  }}
			<font color="#ff0000">已发货</font>
		{{#  } else if(d.orderState == "50") {  }}
			<div><font color="#ff0000">已收款</font></div>
		{{#  } else if(d.orderState == "60") {  }}
			<font color="#ff0000">已退货</font>
		{{#  }  }}
    </script>
    <script type="text/html" id="receiptMethod">	
	   {{#  if(d.receiptMethod == "0") {  }}
			<font color="#99CC66">上门送</font>
		{{#  } else if(d.receiptMethod == "1") {  }}
			<font color="#00FF00">自取</font>
		{{#  }  }}
    </script>
   <script type="text/html" id="operation">
		<a lay-event="confirm"><button class="layui-btn layui-btn-normal" ><i class="layui-icon">&#xe67a;</i>订单收货</button></a>	
    </script>

</html>